﻿//打开、关闭下拉框
function ChangeType(id) {
    if ($("#" + id + "").css("display") == "none") {
        $("#" + id + "").show();
    }
    else {
        $("#" + id + "").hide();
    }
}

//增加下载数
function AddCount(id) {
    $.ajax({
        type: "POST",
        url: "CourseInfo.ashx",
        dataType: "json",
        data: { action: "AddCount", id: id },
        success: function (result) {
        }
    });
}

//视频代码
function GetStrHtml(url, width, height) {
    if (width == null || width == "") {
        width = '550px';
    }
    if (height == null || height == "") {
        height = '450px';
    }
    var strHtml = '<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + width + '" height="' + height + '">';
    strHtml += '<param name="movie" value="' + url + '" />';
    strHtml += '<param name="quality" value="high" />';
    strHtml += '<param name="wmode" value="opaque" />';
    strHtml += '<param name="swfversion" value="8.0.35.0" />';
    strHtml += '<param name="expressinstall" value="../flash/expressInstall.swf" />';
//    strHtml += '<object type="application/x-shockwave-flash" data="' + url + '" width="' + width + '" height="' + height + '">';
//    strHtml += '<param name="quality" value="high" />';
//    strHtml += '<param name="wmode" value="opaque" />';
//    strHtml += '<param name="swfversion" value="8.0.35.0" />';
//    strHtml += '<param name="expressinstall" value="' + url + '" />';
//    strHtml += '<div><h4>此页面上的内容需要较新版本的 Adobe Flash Player。</h4><p>';
//    strHtml += '<a href="http://www.adobe.com/go/getflashplayer">';
//    strHtml += '<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="获取 Adobe Flash Player" width="112" height="33" /></a></p></div></object>';
    strHtml += '</object>';
    return strHtml;
}
//截取url参数
function QueryString() {
    var name, value, i;
    var str = location.href;
    var num = str.indexOf("?")
    str = str.substr(num + 1);
    var arrtmp = str.split("&");
    for (i = 0; i < arrtmp.length; i++) {
        num = arrtmp[i].indexOf("=");
        if (num > 0) {
            name = arrtmp[i].substring(0, num);
            value = arrtmp[i].substr(num + 1);
            this[name] = value;
        }
    }
}

//倒计时跳转
function SendTime(s, id, url) {
    $("#" + id + "").html(s);
    s = s - 1;
    if (s >= 0) {
        setTimeout("SendTime(" + s + ",'" + id + "','" + url + "')", 1000);
    }
    else {
        if (url == "" || url == window.location.href)
            CloseContentDiv();
        else
            window.location.href = url;
    }
}

//获取Cookie值
function GetCookie(c_name, dec) {
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(c_name + "=");
        if (c_start != -1) {
            c_start = c_start + c_name.length + 1;
            c_end = document.cookie.indexOf(";", c_start);
            if (c_end == -1) {
                c_end = document.cookie.length;
            }
            var ret = document.cookie.substring(c_start, c_end);
            return (dec) ? unescape(ret) : ret;
        }
    }
    return "";
}

//设置Cookie值
function SetCookie(c_name, value, expiredays, enc) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    var val = (enc) ? escape(value) : value;
    document.cookie = c_name + "=" + val + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
}


